$(function () {
   obj.init();
});
var obj = new function () {
    'use strict';
    return {
        form:null,
        init:function () {
            
            this.listener();
        },
        listener:function () {
            var $this = this;
            //城市点击事件
            $('.city').click(function () {
                var province = $(this).attr('provinceName');
                $this.funObj().openCityDetail($(this).text(),province);
            });

            $('#bt_view_usage').click(function () {
                $this.funObj().reloadAction();
            })
        },
        funObj:function () {
            var $this = this;
            return {
                openCityDetail:function (cityName,province) {
                    var params = $this.funObj().getParams();
                    params.city = cityName;
                    params.province = province;
                    window.top.xhTop.showModal({
                        title: cityName+'_详情',
                        content: '<iframe  src="'+baseUrl+'stats/cityDetail?'+xhTool.parseParam(params)+'"  style="width: 100%;;border-style: none;padding: 0px;height:500px"  scrolling="yes"></iframe>',
                        width:1000,
                        backClose: false
                    });
                },
                reloadAction:function () {
                    var params = $this.funObj().getParams();
                    console.log(params);
                    window.location.href = baseUrl + 'stats/statsCustomer?' +xhTool.parseParam(params);
                },
                getParams:function () {
                    return {
                        province: $('[name=province]').val(),
                        schoolType: $('[name=schoolType]').val(),
                        startTime: $('[name=startTime]').val(),
                        endTime: $('[name=endTime]').val()
                    };
                }
            }
        }
    }
};